#pragma once

#include <map>

class Item;

using std::map;

#define DEFAULT_INVENTORY_SIZE 10 // Let's default inventory size to 10
#define MAX_INVENTORY_SIZE 50 // Cap the inventory at something so we don't allow 'bags of endless holding'

class Inventory
{
   // Store items in the inventory (health pack, flare, weapon, key, etc.)
   // Items stored by Unique ID, on creation each Item has a unique ID that is used to sort/find items easily
   map<int, Item *> m_mItems;

   int m_iMaxSize; //Maximum number of inventory slots and/or space available
   int m_iCurSize; // Amount of inventory currently consumed with Items
public:
   Inventory(void);
   ~Inventory(void);

   // Adds an item to this inventory container, returns the UniqueID for the newly added item, returns -1 if the item could not be added
   int AddItem(Item * pItem);

   // Remove a particular item from the inventory
   // Returns the pointer to the item that was removed or NULL if an item matching the specs wasn't found
   // If bDelete is true, will delete the Item and not return a pointer to that object, instead will return NULL
   Item * RemoveItem(int iUID, bool bDelete = false);
   Item * RemoveItem(char * sItemName, bool bDelete = false); // remove by name

   Item * GetItemFromInventory(int iUID);
   Item * GetItemFromInventory(char * sName); // find object by name

   void SetInventorySize(int iSize){if (iSize <= MAX_INVENTORY_SIZE)m_iMaxSize = iSize;}
   int GetInventorySize(){return m_iMaxSize;}
};